package com.xdf.ecommerce.service;

import brave.Tracer;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 通过代码获取 sletuch 链路追踪过程中的数据
 * @author chanchaw
 * @create 2025-10-23 9:24
 */
@RequiredArgsConstructor
@Slf4j
@Service
public class SleuthTraceInfoService {
    private final Tracer tracer;
    public void logCurrentTraceInfo(){
        log.info("Sleuth trace id: [{}],span id: [{}]", tracer.currentSpan().context().traceId(), tracer.currentSpan().context().spanId());
    }
}
